import baseRequest from "@/common/js/request.js"

/**
 * 获取课程列表
 */
function getCoursePageList(option) {
  return baseRequest('/etApi/trainCourse/list', option)
}

/**
 * 获取课程详情
 */
function getCourseDetail(id) {
  return baseRequest('/etApi/trainCourse/detail', {id})
}

/**
 * 课程报名
 */
function courseSignUp(option) {
  return baseRequest('/etApi/trainCourseUser/add', option, 'POST')
}

/**
 * 获取课程内容列表
 */
function getCourseContentPageList(option) {
  return baseRequest('/etApi/courseContent/list', option)
}

/**
 * 获取课程内容详情
 */
function getCourseContentDetail(id) {
  return baseRequest('/etApi/courseContent/detail', {id})
}

/**
 * 获取学习时间
 */
function getWatchingTime(option) {
  return baseRequest('/etApi/courseHistory/detail', option)
}

/**
 * 保存学习时间
 */
function saveWatchingTime(option) {
  return baseRequest('/etApi/courseHistory/add', option, 'POST')
}

/**
 * 查询我的课程
 */
function getMyCoursePageList(option) {
  return baseRequest('/etApi/trainCourseUser/myList', option)
}


/**
 * 查询技能申请列表
 */
function getMyApplyPageList(option) {
  return baseRequest('/etApi/skillApply/myList', option)
}

/**
 * 保存技能申请
 */
function saveSkillApply(option) {
	let url = option.id? '/etApi/skillApply/edit':'/etApi/skillApply/add'
	return baseRequest(url, option, 'POST')
}

/**
 * 查询技能申请详情
 */
function getSkillApplyDetail(id) {
  return baseRequest('/etApi/skillApply/detail', {id})
}

/**
 * 删除技能申请
 */
function delSkillApply(ids) {
	return baseRequest('/etApi/skillApply/remove/' + ids, {}, 'POST')
}

export{
	getCoursePageList,
	getCourseDetail,
	courseSignUp,
	getCourseContentPageList,
	getCourseContentDetail,
	saveWatchingTime,
	getWatchingTime,
	getMyCoursePageList,
	getMyApplyPageList,
	saveSkillApply,
	getSkillApplyDetail,
	delSkillApply
}